package com.caocaog.market.finance.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.caocaog.market.finance.entity.FinanceGroup;
import com.caocaog.market.finance.enums.WithdrawStatus;
import com.caocaog.market.finance.enums.WithdrawType;
import org.springframework.lang.Nullable;

import javax.validation.constraints.NotNull;
import java.util.List;


public interface FinanceGroupService extends IService<FinanceGroup> {

    /**
     * 最大提现数量
     */
    int MAX_WITHDRAW_COUNT = 100;

    /**
     * 查询提现集分页信息
     */
    IPage<FinanceGroup> queryFinanceGroupPage(Page<FinanceGroup> page,
                                              FinanceGroup financeGroup);


    /**
     * 根据提现集id查询提现集
     */
    FinanceGroup getFinanceGroupById(Long id);


    /**
     * 申请提现
     */
    void applyWithdrawal(@NotNull List<Long> lineIds, @NotNull WithdrawType type, String site, String merchantId);


    /**
     * 更新提现集
     */
    Integer updateFinanceGroup(FinanceGroup financeGroup);


    /**
     * 删除提现集
     */
    Integer deleteFinanceGroup(Long id);


    /**
     * 审核提现集(更改提现集状态)
     */
    Integer auditFinanceGroup(Long id, WithdrawStatus status, @Nullable String auditRemark);


    /**
     * 转账提现集
     *
     * @return 转账失败信息/转账成功返回null
     */
    @Nullable
    String transferFinanceGroup(Long id);


    /**
     * 数据转移
     */
    @Deprecated
    void dataTransfer();

    @Deprecated
    void updateLine();

}